<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: ActionController::Dispatcher</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">ActionController::Dispatcher</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../files/vendor/rails/actionpack/lib/action_controller/dispatcher_rb.html">
                vendor/rails/actionpack/lib/action_controller/dispatcher.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="../Object.html">
                Object
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
Dispatches requests to the appropriate controller and takes care of
reloading the app after each request when Dependencies.load? is true.
</p>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M001156">call</a>&nbsp;&nbsp;
      <a href="#M001162">checkin_connections</a>&nbsp;&nbsp;
      <a href="#M001158">cleanup_application</a>&nbsp;&nbsp;
      <a href="#M001148">define_dispatcher_callbacks</a>&nbsp;&nbsp;
      <a href="#M001149">dispatch</a>&nbsp;&nbsp;
      <a href="#M001154">dispatch</a>&nbsp;&nbsp;
      <a href="#M001155">dispatch_cgi</a>&nbsp;&nbsp;
      <a href="#M001153">dispatch_unlocked</a>&nbsp;&nbsp;
      <a href="#M001164">failsafe_rescue</a>&nbsp;&nbsp;
      <a href="#M001151">failsafe_response</a>&nbsp;&nbsp;
      <a href="#M001159">flush_logger</a>&nbsp;&nbsp;
      <a href="#M001163">handle_request</a>&nbsp;&nbsp;
      <a href="#M001160">mark_as_test_request!</a>&nbsp;&nbsp;
      <a href="#M001152">new</a>&nbsp;&nbsp;
      <a href="#M001157">reload_application</a>&nbsp;&nbsp;
      <a href="#M001161">test_request?</a>&nbsp;&nbsp;
      <a href="#M001150">to_prepare</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->
    <div id="includes">
      <h3 class="section-bar">Included Modules</h3>

      <div id="includes-list">
        <span class="include-name"><a href="../ActiveSupport/Callbacks.html">ActiveSupport::Callbacks</a></span>
      </div>
    </div>

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M001148" class="method-detail">
        <a name="M001148"></a>

        <div class="method-heading">
          <a href="#M001148" class="method-signature">
          <span class="method-name">define_dispatcher_callbacks</span><span class="method-args">(cache_classes)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001148-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001148-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/actionpack/lib/action_controller/dispatcher.rb, line 8</span>
 8:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">define_dispatcher_callbacks</span>(<span class="ruby-identifier">cache_classes</span>)
 9:         <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">cache_classes</span>
10:           <span class="ruby-comment cmt"># Development mode callbacks</span>
11:           <span class="ruby-identifier">before_dispatch</span> <span class="ruby-identifier">:reload_application</span>
12:           <span class="ruby-identifier">after_dispatch</span> <span class="ruby-identifier">:cleanup_application</span>
13: 
14:           <span class="ruby-constant">ActionView</span><span class="ruby-operator">::</span><span class="ruby-constant">Helpers</span><span class="ruby-operator">::</span><span class="ruby-constant">AssetTagHelper</span>.<span class="ruby-identifier">cache_asset_timestamps</span> = <span class="ruby-keyword kw">false</span>
15:         <span class="ruby-keyword kw">end</span>
16: 
17:         <span class="ruby-comment cmt"># Common callbacks</span>
18:         <span class="ruby-identifier">to_prepare</span> <span class="ruby-identifier">:load_application_controller</span> <span class="ruby-keyword kw">do</span>
19:           <span class="ruby-keyword kw">begin</span>
20:             <span class="ruby-identifier">require_dependency</span> <span class="ruby-value str">'application'</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-keyword kw">defined?</span>(<span class="ruby-operator">::</span><span class="ruby-constant">ApplicationController</span>)
21:           <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">LoadError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">error</span>
22:             <span class="ruby-identifier">raise</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">error</span>.<span class="ruby-identifier">message</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/application\.rb/</span>
23:           <span class="ruby-keyword kw">end</span>
24:         <span class="ruby-keyword kw">end</span>
25: 
26:         <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">defined?</span>(<span class="ruby-constant">ActiveRecord</span>)
27:           <span class="ruby-identifier">after_dispatch</span> <span class="ruby-identifier">:checkin_connections</span>
28:           <span class="ruby-identifier">to_prepare</span>(<span class="ruby-identifier">:activerecord_instantiate_observers</span>) { <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">instantiate_observers</span> }
29:         <span class="ruby-keyword kw">end</span>
30: 
31:         <span class="ruby-identifier">after_dispatch</span> <span class="ruby-identifier">:flush_logger</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">Base</span>.<span class="ruby-identifier">logger</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-constant">Base</span>.<span class="ruby-identifier">logger</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:flush</span>)
32: 
33:         <span class="ruby-identifier">to_prepare</span> <span class="ruby-keyword kw">do</span>
34:           <span class="ruby-constant">I18n</span>.<span class="ruby-identifier">reload!</span>
35:         <span class="ruby-keyword kw">end</span>
36:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001149" class="method-detail">
        <a name="M001149"></a>

        <div class="method-heading">
          <a href="#M001149" class="method-signature">
          <span class="method-name">dispatch</span><span class="method-args">(cgi = nil, session_options = CgiRequest::DEFAULT_SESSION_OPTIONS, output = $stdout)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Backward-compatible class method takes CGI-specific args. Deprecated in
favor of <a href="Dispatcher.html#M001152">Dispatcher.new</a>(output,
request, response).<a href="Dispatcher.html#M001149">dispatch</a>.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001149-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001149-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/actionpack/lib/action_controller/dispatcher.rb, line 40</span>
40:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dispatch</span>(<span class="ruby-identifier">cgi</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">session_options</span> = <span class="ruby-constant">CgiRequest</span><span class="ruby-operator">::</span><span class="ruby-constant">DEFAULT_SESSION_OPTIONS</span>, <span class="ruby-identifier">output</span> = <span class="ruby-identifier">$stdout</span>)
41:         <span class="ruby-identifier">new</span>(<span class="ruby-identifier">output</span>).<span class="ruby-identifier">dispatch_cgi</span>(<span class="ruby-identifier">cgi</span>, <span class="ruby-identifier">session_options</span>)
42:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001151" class="method-detail">
        <a name="M001151"></a>

        <div class="method-heading">
          <a href="#M001151" class="method-signature">
          <span class="method-name">failsafe_response</span><span class="method-args">(fallback_output, status, originating_exception = nil) {|| ...}</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
If the block raises, send status code as a last-ditch response.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001151-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001151-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/actionpack/lib/action_controller/dispatcher.rb, line 59</span>
59:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">failsafe_response</span>(<span class="ruby-identifier">fallback_output</span>, <span class="ruby-identifier">status</span>, <span class="ruby-identifier">originating_exception</span> = <span class="ruby-keyword kw">nil</span>)
60:         <span class="ruby-keyword kw">yield</span>
61:       <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">exception</span>
62:         <span class="ruby-keyword kw">begin</span>
63:           <span class="ruby-identifier">log_failsafe_exception</span>(<span class="ruby-identifier">status</span>, <span class="ruby-identifier">originating_exception</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">exception</span>)
64:           <span class="ruby-identifier">body</span> = <span class="ruby-identifier">failsafe_response_body</span>(<span class="ruby-identifier">status</span>)
65:           <span class="ruby-identifier">fallback_output</span>.<span class="ruby-identifier">write</span> <span class="ruby-node">&quot;Status: #{status}\r\nContent-Type: text/html\r\n\r\n#{body}&quot;</span>
66:           <span class="ruby-keyword kw">nil</span>
67:         <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">failsafe_error</span> <span class="ruby-comment cmt"># Logger or IO errors</span>
68:           <span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Error during failsafe response: #{failsafe_error}&quot;</span>
69:           <span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;(originally #{originating_exception})&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">originating_exception</span>
70:         <span class="ruby-keyword kw">end</span>
71:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001152" class="method-detail">
        <a name="M001152"></a>

        <div class="method-heading">
          <a href="#M001152" class="method-signature">
          <span class="method-name">new</span><span class="method-args">(output = $stdout, request = nil, response = nil)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001152-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001152-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/actionpack/lib/action_controller/dispatcher.rb, line 105</span>
105:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">output</span> = <span class="ruby-identifier">$stdout</span>, <span class="ruby-identifier">request</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">response</span> = <span class="ruby-keyword kw">nil</span>)
106:       <span class="ruby-ivar">@output</span>, <span class="ruby-ivar">@request</span>, <span class="ruby-ivar">@response</span> = <span class="ruby-identifier">output</span>, <span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>
107:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001150" class="method-detail">
        <a name="M001150"></a>

        <div class="method-heading">
          <a href="#M001150" class="method-signature">
          <span class="method-name">to_prepare</span><span class="method-args">(identifier = nil, &amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Add a preparation callback. Preparation callbacks are run before every
request in development mode, and before the first request in production
mode.
</p>
<p>
An optional identifier may be supplied for the callback. If provided, <a
href="Dispatcher.html#M001150">to_prepare</a> may be called again with the
same identifier to replace the existing callback. Passing an identifier is
a suggested practice if the code adding a preparation block may be
reloaded.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001150-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001150-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/actionpack/lib/action_controller/dispatcher.rb, line 52</span>
52:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_prepare</span>(<span class="ruby-identifier">identifier</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
53:         <span class="ruby-ivar">@prepare_dispatch_callbacks</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">Callbacks</span><span class="ruby-operator">::</span><span class="ruby-constant">CallbackChain</span>.<span class="ruby-identifier">new</span>
54:         <span class="ruby-identifier">callback</span> = <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">Callbacks</span><span class="ruby-operator">::</span><span class="ruby-constant">Callback</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">:prepare_dispatch</span>, <span class="ruby-identifier">block</span>, <span class="ruby-identifier">:identifier</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">identifier</span>)
55:         <span class="ruby-ivar">@prepare_dispatch_callbacks</span>.<span class="ruby-identifier">replace_or_append!</span>(<span class="ruby-identifier">callback</span>)
56:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M001156" class="method-detail">
        <a name="M001156"></a>

        <div class="method-heading">
          <a href="#M001156" class="method-signature">
          <span class="method-name">call</span><span class="method-args">(env)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001156-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001156-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/actionpack/lib/action_controller/dispatcher.rb, line 140</span>
140:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
141:       <span class="ruby-ivar">@request</span> = <span class="ruby-constant">RackRequest</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">env</span>)
142:       <span class="ruby-ivar">@response</span> = <span class="ruby-constant">RackResponse</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@request</span>)
143:       <span class="ruby-identifier">dispatch</span>
144:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001162" class="method-detail">
        <a name="M001162"></a>

        <div class="method-heading">
          <a href="#M001162" class="method-signature">
          <span class="method-name">checkin_connections</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001162-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001162-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/actionpack/lib/action_controller/dispatcher.rb, line 175</span>
175:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">checkin_connections</span>
176:       <span class="ruby-comment cmt"># Don't return connection (and peform implicit rollback) if this request is a part of integration test</span>
177:       <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">test_request?</span>
178:       <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">clear_active_connections!</span>
179:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001158" class="method-detail">
        <a name="M001158"></a>

        <div class="method-heading">
          <a href="#M001158" class="method-signature">
          <span class="method-name">cleanup_application</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Cleanup the application by clearing out loaded classes so they can be
reloaded on the next request without restarting the server.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001158-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001158-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/actionpack/lib/action_controller/dispatcher.rb, line 156</span>
156:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cleanup_application</span>
157:       <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">reset_subclasses</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">defined?</span>(<span class="ruby-constant">ActiveRecord</span>)
158:       <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">Dependencies</span>.<span class="ruby-identifier">clear</span>
159:       <span class="ruby-constant">ActiveRecord</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">clear_reloadable_connections!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">defined?</span>(<span class="ruby-constant">ActiveRecord</span>)
160:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001154" class="method-detail">
        <a name="M001154"></a>

        <div class="method-heading">
          <a href="#M001154" class="method-signature">
          <span class="method-name">dispatch</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001154-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001154-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/actionpack/lib/action_controller/dispatcher.rb, line 120</span>
120:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dispatch</span>
121:       <span class="ruby-keyword kw">if</span> <span class="ruby-constant">ActionController</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">allow_concurrency</span>
122:         <span class="ruby-identifier">dispatch_unlocked</span>
123:       <span class="ruby-keyword kw">else</span>
124:         <span class="ruby-ivar">@@guard</span>.<span class="ruby-identifier">synchronize</span> <span class="ruby-keyword kw">do</span>
125:           <span class="ruby-identifier">dispatch_unlocked</span>
126:         <span class="ruby-keyword kw">end</span>
127:       <span class="ruby-keyword kw">end</span>
128:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001155" class="method-detail">
        <a name="M001155"></a>

        <div class="method-heading">
          <a href="#M001155" class="method-signature">
          <span class="method-name">dispatch_cgi</span><span class="method-args">(cgi, session_options)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001155-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001155-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/actionpack/lib/action_controller/dispatcher.rb, line 130</span>
130:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dispatch_cgi</span>(<span class="ruby-identifier">cgi</span>, <span class="ruby-identifier">session_options</span>)
131:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">cgi</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">failsafe_response</span>(<span class="ruby-ivar">@output</span>, <span class="ruby-value str">'400 Bad Request'</span>) { <span class="ruby-constant">CGI</span>.<span class="ruby-identifier">new</span> }
132:         <span class="ruby-ivar">@request</span> = <span class="ruby-constant">CgiRequest</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">cgi</span>, <span class="ruby-identifier">session_options</span>)
133:         <span class="ruby-ivar">@response</span> = <span class="ruby-constant">CgiResponse</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">cgi</span>)
134:         <span class="ruby-identifier">dispatch</span>
135:       <span class="ruby-keyword kw">end</span>
136:     <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">exception</span>
137:       <span class="ruby-identifier">failsafe_rescue</span> <span class="ruby-identifier">exception</span>
138:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001153" class="method-detail">
        <a name="M001153"></a>

        <div class="method-heading">
          <a href="#M001153" class="method-signature">
          <span class="method-name">dispatch_unlocked</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001153-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001153-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/actionpack/lib/action_controller/dispatcher.rb, line 109</span>
109:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">dispatch_unlocked</span>
110:       <span class="ruby-keyword kw">begin</span>
111:         <span class="ruby-identifier">run_callbacks</span> <span class="ruby-identifier">:before_dispatch</span>
112:         <span class="ruby-identifier">handle_request</span>
113:       <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">exception</span>
114:         <span class="ruby-identifier">failsafe_rescue</span> <span class="ruby-identifier">exception</span>
115:       <span class="ruby-keyword kw">ensure</span>
116:         <span class="ruby-identifier">run_callbacks</span> <span class="ruby-identifier">:after_dispatch</span>, <span class="ruby-identifier">:enumerator</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">:reverse_each</span>
117:       <span class="ruby-keyword kw">end</span>
118:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001159" class="method-detail">
        <a name="M001159"></a>

        <div class="method-heading">
          <a href="#M001159" class="method-signature">
          <span class="method-name">flush_logger</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001159-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001159-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/actionpack/lib/action_controller/dispatcher.rb, line 162</span>
162:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">flush_logger</span>
163:       <span class="ruby-constant">Base</span>.<span class="ruby-identifier">logger</span>.<span class="ruby-identifier">flush</span>
164:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001160" class="method-detail">
        <a name="M001160"></a>

        <div class="method-heading">
          <a href="#M001160" class="method-signature">
          <span class="method-name">mark_as_test_request!</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001160-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001160-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/actionpack/lib/action_controller/dispatcher.rb, line 166</span>
166:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mark_as_test_request!</span>
167:       <span class="ruby-ivar">@test_request</span> = <span class="ruby-keyword kw">true</span>
168:       <span class="ruby-keyword kw">self</span>
169:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001157" class="method-detail">
        <a name="M001157"></a>

        <div class="method-heading">
          <a href="#M001157" class="method-signature">
          <span class="method-name">reload_application</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001157-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001157-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/actionpack/lib/action_controller/dispatcher.rb, line 146</span>
146:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reload_application</span>
147:       <span class="ruby-comment cmt"># Run prepare callbacks before every request in development mode</span>
148:       <span class="ruby-identifier">run_callbacks</span> <span class="ruby-identifier">:prepare_dispatch</span>
149: 
150:       <span class="ruby-constant">Routing</span><span class="ruby-operator">::</span><span class="ruby-constant">Routes</span>.<span class="ruby-identifier">reload</span>
151:       <span class="ruby-constant">ActionController</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">view_paths</span>.<span class="ruby-identifier">reload!</span>
152:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001161" class="method-detail">
        <a name="M001161"></a>

        <div class="method-heading">
          <a href="#M001161" class="method-signature">
          <span class="method-name">test_request?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001161-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001161-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/actionpack/lib/action_controller/dispatcher.rb, line 171</span>
171:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_request?</span>
172:       <span class="ruby-ivar">@test_request</span>
173:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Protected Instance methods</h3>

      <div id="method-M001164" class="method-detail">
        <a name="M001164"></a>

        <div class="method-heading">
          <a href="#M001164" class="method-signature">
          <span class="method-name">failsafe_rescue</span><span class="method-args">(exception)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001164-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001164-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/actionpack/lib/action_controller/dispatcher.rb, line 187</span>
187:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">failsafe_rescue</span>(<span class="ruby-identifier">exception</span>)
188:         <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">failsafe_response</span>(<span class="ruby-ivar">@output</span>, <span class="ruby-value str">'500 Internal Server Error'</span>, <span class="ruby-identifier">exception</span>) <span class="ruby-keyword kw">do</span>
189:           <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@controller</span> <span class="ruby-operator">||=</span> <span class="ruby-keyword kw">defined?</span>(<span class="ruby-operator">::</span><span class="ruby-constant">ApplicationController</span>) <span class="ruby-operator">?</span> <span class="ruby-operator">::</span><span class="ruby-constant">ApplicationController</span> <span class="ruby-operator">:</span> <span class="ruby-constant">Base</span>
190:             <span class="ruby-ivar">@controller</span>.<span class="ruby-identifier">process_with_exception</span>(<span class="ruby-ivar">@request</span>, <span class="ruby-ivar">@response</span>, <span class="ruby-identifier">exception</span>).<span class="ruby-identifier">out</span>(<span class="ruby-ivar">@output</span>)
191:           <span class="ruby-keyword kw">else</span>
192:             <span class="ruby-identifier">raise</span> <span class="ruby-identifier">exception</span>
193:           <span class="ruby-keyword kw">end</span>
194:         <span class="ruby-keyword kw">end</span>
195:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001163" class="method-detail">
        <a name="M001163"></a>

        <div class="method-heading">
          <a href="#M001163" class="method-signature">
          <span class="method-name">handle_request</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001163-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001163-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/actionpack/lib/action_controller/dispatcher.rb, line 182</span>
182:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">handle_request</span>
183:         <span class="ruby-ivar">@controller</span> = <span class="ruby-constant">Routing</span><span class="ruby-operator">::</span><span class="ruby-constant">Routes</span>.<span class="ruby-identifier">recognize</span>(<span class="ruby-ivar">@request</span>)
184:         <span class="ruby-ivar">@controller</span>.<span class="ruby-identifier">process</span>(<span class="ruby-ivar">@request</span>, <span class="ruby-ivar">@response</span>).<span class="ruby-identifier">out</span>(<span class="ruby-ivar">@output</span>)
185:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>